package com.lwlk.zdk.controller.Excel;

import com.lwlk.zdk.enums.RetCode;
import com.lwlk.zdk.model.Encapsulation.EncapsulationThePoliceStatistics;
import com.lwlk.zdk.model.Encapsulation.EncapsulationVehicle;
import com.lwlk.zdk.model.statistics.ThePoliceStatistics;
import com.lwlk.zdk.util.ExcelUtil;
import com.lwlk.zdk.util.Response;
import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;

@RestController
@RequestMapping(value = "/excel")
public class ThePoliceStatisticsController {




    @RequestMapping(value = "/ThePoliceStatisticsOutExcel",method = RequestMethod.POST)
    public Response outExcel(@RequestBody List<ThePoliceStatistics> thePoliceStatisticsList,ServletOutputStream out){
        Response resp=new Response();
        try {
            ExcelUtil.exportUserExcel(thePoliceStatisticsList,out);
        }catch (Exception e){
            e.printStackTrace();
        }
        resp.setData(1);
        resp.setCode(RetCode.SUCCESS);
        resp.setMsg("执行成功");
        return resp;
    }



}
